import request from "@/utils/request";

// 订单相关API
const orderApi = {
	//商品下单
	createOrder(data : CreateParams) {
		return request.post<dataResult>({ url: "/api/customer/order/create", data });
	},
	//订单列表
	getlist(data : GetListParams) {
		return request.post<dataResult>({ url: "/api/customer/order/getlist", data });
	},
	//订单详情
	getdetail(data : GetDetailParams) {
		return request.post<dataResult>({ url: "/api/customer/order/getdetail", data });
	}
};

export default orderApi;

interface dataResult {
	data ?: any;
	message : string;
	status : number;
}

//商品下单请求参数
interface CreateParams {
	product_id : number;
	quantity : number;
	contents : any;
}

//获取订单列表请求参数
interface GetListParams {
	page : number;
	limit : number;
	keyword : string;
	keyword_type : string;
	status : number;
}

//订单详情请求参数
interface GetDetailParams {
	order_no : string;
}